<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
  <head>
    <meta charset="utf-8" />
    <meta name="generator" content="pandoc" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, user-scalable=yes"
    />
    <title>python_syntax</title>
    <style type="text/css">
      code {
        white-space: pre-wrap;
      }
      span.smallcaps {
        font-variant: small-caps;
      }
      span.underline {
        text-decoration: underline;
      }
      div.column {
        display: inline-block;
        vertical-align: top;
        width: 50%;
      }
    </style>
  </head>
  <body>
    <h1 id="python-syntax">Python Syntax</h1>
    <p>
      <strong>Python Syntax compared to other programming languages</strong>
    </p>
    <ul>
      <li>
        Python was designed to for readability, and has some similarities to the
        English language with influence from mathematics.
      </li>
      <li>
        Python uses new lines to complete a command, as opposed to other
        programming languages which often use semicolons or parentheses.
      </li>
      <li>
        Python relies on indentation, using whitespace, to define scope; such as
        the scope of loops, functions and classes. Other programming languages
        often use curly-brackets for this purpose.
      </li>
    </ul>
    <h2 id="python-indentations">Python Indentations</h2>
    <p>
      Where in other programming languages the indentation in code is for
      readability only, in Python the indentation is very important.
    </p>
    <p>Python uses indentation to indicate a block of code.</p>
    <pre><code>if 5 &gt; 2:
  print(&quot;Five is greater than two!&quot;)</code></pre>
    <p>Python will give you an error if you skip the indentation.</p>
    <h2 id="comments">Comments</h2>
    <p>
      Python has commenting capability for the purpose of in-code documentation.
    </p>
    <p>
      Comments start with a <code>#</code>, and Python will render the rest of
      the line as a comment:
    </p>
    <pre><code>#This is a comment.
print(&quot;Hello, World!&quot;)</code></pre>
    <h2 id="docstrings">Docstrings</h2>
    <p>Python also has extended documentation capability, called docstrings.</p>
    <p>
      Docstrings can be one line, or multiline. Docstrings are also comments:
    </p>
    <p>Python uses triple quotes at the beginning and end of the docstring:</p>
    <pre><code>&quot;&quot;&quot;This is a
multiline docstring.&quot;&quot;&quot;
print(&quot;Hello, World!&quot;)</code></pre>
    <h2 id="references">References</h2>
    <ul>
      <li>
        <a href="https://www.w3schools.com/python/python_syntax.asp"
          >w3schools.com</a
        >
      </li>
    </ul>
  </body>
</html>
